/**
 * @ Author: luoqi
 * @ Create Time: 2024-04-01 23:04
 * @ Modified by: luoqi
 * @ Modified time: 2024-04-02 22:40
 * @ Description:
 */

#ifndef _JY901_H
#define _JY901_H

#include <stdint.h>

typedef struct {
    float acc_x; // acceleration x
    float acc_y; // acceleration y
    float acc_z; // acceleration z
    float w_x;   // angle velocity x
    float w_y;   // angle velocity y
    float w_z;   // angle velocity z
    float agl_x; // angle x
    float agl_y; // angle y
    float agl_z; // angle z
    float temperature; // temperature
    uint8_t issof; // is start of frame
    uint8_t recvcnt; // receive counter
    uint8_t data[11]; 
    
    int (*read)(uint8_t*, int);
} JY901Obj;

int jy901_init(JY901Obj *obj);

int jy901_decode(JY901Obj *obj, uint8_t *data, int size);

#endif
